/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author bluepc
 */
@Entity
@Table(name = "Tabletype")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tabletype.findAll", query = "SELECT t FROM Tabletype t"),
    @NamedQuery(name = "Tabletype.findByIdType", query = "SELECT t FROM Tabletype t WHERE t.idType = :idType"),
    @NamedQuery(name = "Tabletype.findByTableType", query = "SELECT t FROM Tabletype t WHERE t.tableType = :tableType"),
    @NamedQuery(name = "Tabletype.findByTabletypeStatus", query = "SELECT t FROM Tabletype t WHERE t.tabletypeStatus = :tabletypeStatus")})
public class Tabletype implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer idType;
    @Size(max = 50)
    @Column(name = "table_type")
    private String tableType;
    @Basic(optional = false)
    @NotNull
    @Column(name = "tabletype_status")
    private boolean tabletypeStatus;
    @OneToMany(mappedBy = "idType")
    private List<Tables> tablesList;

    public Tabletype() {
    }

    public Tabletype(Integer idType) {
        this.idType = idType;
    }

    public Tabletype(Integer idType, boolean tabletypeStatus) {
        this.idType = idType;
        this.tabletypeStatus = tabletypeStatus;
    }

    public Integer getIdType() {
        return idType;
    }

    public void setIdType(Integer idType) {
        this.idType = idType;
    }

    public String getTableType() {
        return tableType;
    }

    public void setTableType(String tableType) {
        this.tableType = tableType;
    }

    public boolean getTabletypeStatus() {
        return tabletypeStatus;
    }

    public void setTabletypeStatus(boolean tabletypeStatus) {
        this.tabletypeStatus = tabletypeStatus;
    }

    @XmlTransient
    public List<Tables> getTablesList() {
        return tablesList;
    }

    public void setTablesList(List<Tables> tablesList) {
        this.tablesList = tablesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idType != null ? idType.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tabletype)) {
            return false;
        }
        Tabletype other = (Tabletype) object;
        if ((this.idType == null && other.idType != null) || (this.idType != null && !this.idType.equals(other.idType))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Tabletype[ idType=" + idType + " ]";
    }
    
}
